<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <title>图书信息添加</title>
    <link rel="stylesheet" href="../css/bootstrap.min.css">
    <script src="../js/jquery-3.2.1.js"></script>
    <script src="../js/bootstrap.min.js"></script>
    <style>
        .form-group {
            margin-bottom: 0;
        }
    </style>
    <script>
        $(function () {
            $('#header').load('/admin/header');
        })
    </script>
</head>
<body background="../img/sky.jpg" style=" background-repeat:no-repeat ;
background-size:100% 100%;
background-attachment: fixed;">

<div id="header"></div>

    <div class="col-xs-6 col-md-offset-3" style="padding-top: 100px;position: relative">
    <div class="panel panel-primary">
        <div class="panel-heading">
            <h3 class="panel-title">添加图书</h3>
        </div>
        <div class="panel-body">
    <form action="/book/addBook" method="post" id="addbook">

        <div class="input-group" style="padding-top: 20px;">
            <span  class="input-group-addon">图书名</span>
            <input type="text" class="form-control" name="name" id="name" placeholder="请输入书名">
        </div>
        <br>
        <div class="input-group" style="padding-top: 20px;">
            <span  class="input-group-addon">作者</span>
            <input type="text" class="form-control" name="author" id="author" placeholder="请输入作者名">
        </div>
        <br>
        <div class="input-group" style="padding-top: 20px;">
                <span  class="input-group-addon">出版社</span>
            <input type="text" class="form-control" name="publish" id="publish" placeholder="请输入出版社">
        </div>
        <br>
        <div class="input-group" style="padding-top: 20px;">
                <span  class="input-group-addon">ISBN</span>
            <input type="text" class="form-control" name="isbn" id="isbn" placeholder="请输入ISBN">
        </div>
        <br>
        <div class="input-group" style="padding-top: 20px;">
                <span  class="input-group-addon" >简介</span>
            <textarea class="form-control" rows="3" name="introduction" id="introduction"
                      placeholder="请输入简介"></textarea>
        </div>
        <br>
        <div class="input-group" style="padding-top: 20px;">
                <span  class="input-group-addon" >语言</span>
            <input type="text" class="form-control" name="language" id="language" placeholder="请输入语言">
        </div>
        <br>
        <div class="input-group" style="padding-top: 20px;">
                <span  class="input-group-addon" >价格</span>
            <input type="text" class="form-control" name="price" id="price" placeholder="请输入价格">
        </div>
        <br>
        <div class="input-group" style="padding-top: 20px;">
                <span  class="input-group-addon" >出版日期</span>
            <input type="date" class="form-control" name="pubDate" id="pubstr" placeholder="请输入出版日期">
        </div>
        <br>
        <div class="input-group" style="padding-top: 20px;">
            <span  class="input-group-addon">分类名称</span>
            <%--<input type="text" class="form-control" name="classId" id="classId" placeholder="请输入分类号">--%>
            <select id="classId" name="classId" class="form-control">
                <c:forEach items="${classInfoList}" var="classInfo">
                    <option value="${classInfo.classId}">${classInfo.className}</option>
                </c:forEach>
            </select>
        </div>
        <br>
        <div class="input-group" style="padding-top: 20px;">
            <span  class="input-group-addon" >数量</span>
            <input type="number" class="form-control" name="number" id="number" placeholder="请输入图书数量">
        </div>
        <br>
        <input type="submit" value="添加" class="btn btn-success btn-sm" class="text-left">
        <script>
            $("#addbook").submit(function () {
                if ($("#name").val() == '' || $("#author").val() == '' || $("#publish").val() == '' || $("#isbn").val() == '' || $("#introduction").val() == '' || $("#language").val() == '' || $("#price").val() == '' || $("#pubstr").val() == '' || $("#classId").val() == '' || $("#pressmark").val() == '' || $("#number").val() == '') {
                    alert("请填入完整图书信息！");
                    return false;
                }
            })
        </script>

    </form>
    </div>
    </div>
</div>
</body>
</html>
